<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('产品二维码申请记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/>
                    <input type="hidden" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreateTime]"/>
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>厂家名称：</label>
                                <input type="text" name="factoryName"/>
                            </li>
                            <li>
                                <label>产品名称：</label>
                                <input type="text" name="partsName"/>
                            </li>
                            <li>
                                <label>规格名称：</label>
                                <input type="text" name="attributeName"/>
                            </li>
                            <li>
                                <label style="width: 100px;">二维码编码：</label>
                                <input type="text" name="qrcodeFirst"/>
                            </li>
                            <li>
                                <label style="width: 140px;">质保补助金金额：</label>
                                <input type="text" name="payPrice"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('zsyh:qrcodeHistory:edit')}]];
        var removeFlag = [[${@permission.hasPermi('zsyh:qrcodeHistory:remove')}]];
        var prefix = ctx + "zsyh/qrcodeHistory";
        //获取当前时间
        //判断是否在前面加0
        function getNow(s) {
            return s < 10 ? '0' + s: s;
        }
        var myDate = new Date();
        var year=myDate.getFullYear();        //获取当前年
        var month=myDate.getMonth()+1;   //获取当前月
        var date=myDate.getDate();            //获取当前日
        $("#startTime").val(year+'-'+getNow(month)+"-"+getNow(date)+" 00:00:00");
        $("#endTime").val(year+'-'+getNow(month)+"-"+getNow(date)+" 23:59:59");

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                modalName: "产品二维码申请记录",
                columns: [ {
                    field: 'index',
                    align: 'center',
                    title: "序号",
                    formatter: function (value, row, index) {
                        var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                        return columnIndex + $.table.serialNumber(index);
                    }
                },
                {
                    field: 'id',
                    title: '配件二维码生成历史',
                    align: 'center',
                    visible: false
                },
                    {
                        field: 'factoryName',
                        align: 'center',
                        title: '厂家名称'
                    },
                {
                    field: 'partsName',
                    align: 'center',
                    title: '产品名称'
                },
                {
                    field: 'attributeName',
                    align: 'center',
                    title: '规格名称'
                },
                {
                    field: 'startCode',
                    align: 'center',
                    title: '开始编码'
                },
                {
                    field: 'endCode',
                    align: 'center',
                    title: '结束编码'
                },
                {
                    field: 'applyNum',
                    align: 'center',
                    title: '生成数量'
                },
                {
                    field: 'qrcodeFirst',
                    align: 'center',
                    title: '二维码编码前半部分'
                },
                {
                    field: 'payPrice',
                    align: 'center',
                    title: '质保补助金金额'
                },
                    {
                        field: 'createTime',
                        align: 'center',
                        title: '申请时间'
                    },
                    {
                        field: 'operateName',
                        align: 'center',
                        title: '申请人'
                    },
                /*{
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/]
            };
            $.table.init(options);
        });

        function addHistory() {
            var url = prefix + "/add";
            var index =layer.open({
                type: 2,
                area: ['800px', '600px'],
                fix: false,
                //不固定
                maxmin: true,
                shade: 0.3,
                title: "申请二维码",
                content:  url,
                closeBtn: 1,
                // 弹层外区域关闭
                shadeClose: true,
                end: function(index, layero) {
                    debugger;
                    /*var iframeWin = layero.find('iframe')[0];
                    iframeWin.contentWindow.closeItem1();*/
                    layer.close(layer.index);
                },
                cancel: function(index) {
                    return true;
                }
            });
        }

    </script>
</body>
</html>